<?php if(empty($r['record'])){ echo "亲，暂时还没有报备信息哦~"?>
<?php }else{?>
<form>
    <fieldset>
        <legend></legend>
        <table id="dataTable">
            <thead>
            <tr>
                <th>ID</th>
                <th>商品名</th>
                <th>购买者姓名</th>
                <th>购买者电话</th>
                <th>是否<br/>购买</th>
                <th>类型</th>
                <th>当前状态</th>
                <th>申请时间</th>
                <th>解禁时间</th>
                <th>操作</th>
                <th>撤销</th>
            </tr>
            </thead>
            <tbody>
            <?php foreach($r['record'] as $v){?>
                <tr>
                    <td><?php echo $v['id']?></td>
                    <td><?php if(mb_strlen($v['gopen_id'])<11)
                            echo $v['gopen_id'];
                        else{
                            echo mb_substr($v['gopen_id'],0,10,"UTF-8");
                            echo "<br/>";
                            echo mb_substr($v['gopen_id'],10,17,"UTF-8");
                            echo "...";
                        }?></td>
                    <td><?php echo $v['name']?></td>
                    <td><?php echo $v['tel']?></td>
                    <td><?php foreach($r['buyState'] as $k=>$s){?>
                            <?php if($k==$v['buy']) echo $s?>
                        <?php } ?></td>
                    <td><?php foreach($r['recordState'] as $k=>$s){?>
                            <?php if($k==$v['type']) echo $s?>
                        <?php } ?></td>
                    <td><?php foreach($r['currentState'] as $k=>$s){?>
                            <?php if($k==$v['state']) echo $s?>
                        <?php } ?></td>
                    <td><?php echo $v['create_time']?></td>
                    <td><?php echo date('Y-m-d',strtotime($v['create_time'] . '+15 day'));?></td>
                    <td><?php if(($v['type']!='group')&&(date('Y-m-d',strtotime($v['create_time'] . '+15 day'))>=$r['today_time'])){
                        switch($v['state']){
                            case 'waiting' : ?><a href="<?php e_action("saw","id={$v['id']}");?>">客户已看房</a><?php break;
                            case 'saw'  : ?><a href="<?php e_action("deposit","id={$v['id']}");?>">客户已缴纳订金</a><?php break;
                            case 'deposit' : ?><a href="<?php e_action("front","id={$v['id']}");?>">客户已缴纳首付</a><?php break;
                            case 'front' : ?><a href="<?php e_action("all","id={$v['id']}");?>">客户已缴纳全款</a><?php break;
                            case 'all' : ?><a href="<?php e_action("finish","id={$v['id']}");?>">完成销售</a><?php break;
                            case 'finish' :?><a href="<?php e_action("profit","id={$v['id']}");?>">已收到分成</a><?php break;
                            case 'profit' :?><?php echo "交易完成";?><?php break;
//                            default :?><!--<a href="--><?php //e_action("undo","id={$v['id']}");?><!--"撤销已缴纳定金确认</a>--><?php //break;
                        }
                    }else if(date('Y-m-d',strtotime($v['create_time'] . '+15 day'))<=$r['today_time']){  echo "报备超时" ;?><?php } ?></td>
                    <td><?php if(($v['type']!='group')&&(date('Y-m-d',strtotime($v['create_time'] . '+15 day'))>=$r['today_time'])){
                            switch($v['state']){
                                case 'saw' : ?><a href="<?php e_action("unsaw","id={$v['id']}");?>">撤销已看房确认</a><?php break;
                                case 'deposit'  : ?><a href="<?php e_action("undeposit","id={$v['id']}");?>">撤销已缴纳订金确认</a><?php break;
                                case 'front' : ?><a href="<?php e_action("unfront","id={$v['id']}");?>">撤销已缴纳首付确认</a><?php break;
                                case 'all' : ?><a href="<?php e_action("unall","id={$v['id']}");?>">撤销已缴纳全款确认</a><?php break;
                                case 'finish' : ?><a href="<?php e_action("unfinish","id={$v['id']}");?>">撤销完成销售确认</a><?php break;
                                case 'profit' :?><a href="<?php e_action("unprofit","id={$v['id']}");?>">撤销已收到分成确认</a><?php break;
                            }
                        }?>
                    </td>
                </tr>
            <?php }?>
            </tbody>
        </table>
    </fieldset>
</form>
<?php
/** @var Page $page */
$page=$r['pages'];
?>
<?php echo $page->getPageHtml(); ?>
<?php }?>